#include "stdafx.h"
#include "DataTableRecordCollection.h"
#include "DataTableRecord.h"

using namespace Dimine::Core;

dmDataTableRecordCS^ dmDataTableRecordCollectionCS::GetRecord(int recordID)
{
	if(!m_native) return nullptr;
	return gcnew dmDataTableRecordCS(m_native->Get_Record(recordID));
}

dmDataTableRecordCollectionCS::dmDataTableRecordCollectionCS(dmDataTableCS^ table)
{
	Native=table->Native;
}

dmDataTableRecordCS^ dmDataTableRecordCollectionCS::Add(dmDataTableRecordCS^ record)
{
	if(!m_native)
		return nullptr;
	return gcnew dmDataTableRecordCS(m_native->Add_Record(record->Native));
}
dmDataTableRecordCS^ dmDataTableRecordCollectionCS::Insert(int recordID,dmDataTableRecordCS^ record)
{
	if(!m_native)
		return nullptr;
	return gcnew dmDataTableRecordCS(m_native->Ins_Record(recordID,record->Native));
}
bool dmDataTableRecordCollectionCS::Delete(int recordID)
{
	VALIDATE_NATIVE
	return m_native->Del_Record(recordID);
}
bool dmDataTableRecordCollectionCS::Clear()
{
	VALIDATE_NATIVE
	return m_native->Del_Records();
}